print("start testquicklz")
local quicklz = require "quicklz.core"

-- local t = ...
local t = 1
t = tonumber(t)
print("t", t)
print(quicklz)
print(quicklz.compress)
print(quicklz.decompress)


local sourceData = "54sd6f321321321321321321321321321321g4s6d5f4g6sd5f4g6s5df4g6s5df4g65s4dfg65sd4fg46w5r9q8w6241"

local function fun1()
	quicklz.test(sourceData)
end

local function fun2()
	print("source:", #sourceData)
	local cped, s = quicklz.compress(sourceData)
	print("compressed size:", s)
	print("compressed ctx:", cped)
	local decped = quicklz.decompress(cped, s)
	print("decompress", #decped)
	print(decped)

	print("end testquicklz")
end

local function fun3()
	while true do
		for i = 1, 100000 do
			local cped, s = quicklz.compress(sourceData)
			local decped = quicklz.decompress(cped, s)
			print("count1", collectgarbage("count"))
			collectgarbage("collect")
			print("count2", collectgarbage("count"))
		end
	end
end

local function fun4()
	while true do
		for i = 1, 100000 do
			local cped, s = {}
		end
		print("count1", collectgarbage("count"))
		collectgarbage("collect")
		print("count2", collectgarbage("count"))
	end
end

if t == 1 then
	print("fun1")
	fun1()
elseif t == 2 then
	print("fun2")
	fun2()
elseif t == 3 then
	print("fun3")
	fun3()
elseif t == 4 then
	print("fun4")
	fun4()
elseif t == 5 then
	print("fun5")
	fun5()
end
